package junitTest;

import static org.junit.Assert.*;

import java.io.IOException;

import org.junit.Before;
import org.junit.Test;
import wCount.ScDeal;
public class ScDealTest {

	@Before
	public void setUp() throws Exception {
	}

	@Test
	public void testi() throws IOException {  //测试-i
		String[] str = {"-i","D:/text.txt"};
		ScDeal sd=new ScDeal(str);
		sd.judge();
		assertEquals("1065\r\n" + 
				"104\r\n" + 
				"4\r\n" + 
				"<learn>:4\r\n" + 
				"<study>:4\r\n" + 
				"<from>:3\r\n" + 
				"<knowledge>:3\r\n" + 
				"<need>:3\r\n" + 
				"<believe>:2\r\n" + 
				"<important>:2\r\n" + 
				"<learning>:2\r\n" + 
				"<lifelong>:2\r\n" + 
				"<people>:2\r\n" + 
				"",sd.w);
	}
	@Test
	public void testm() throws IOException {		//测试-m
		String[] str = {"-m","4","-i","D:/text.txt"};
		ScDeal sd=new ScDeal(str);
		sd.judge();
		assertEquals("1065\r\n" + 
				"104\r\n" + 
				"4\r\n" + 
				"<Some people believe that>:1\r\n" + 
				"<also learning things from>:1\r\n" + 
				"<believe that when they>:1\r\n" + 
				"<learn from school provides>:1\r\n" + 
				"<learn more knowledge, because>:1\r\n" + 
				"<learning things from life,>:1\r\n" + 
				"<life. Some people believe>:1\r\n" + 
				"<people believe that when>:1\r\n" + 
				"<world develops every minute>:1\r\n" + 
				"<wrong conception about study.>:1\r\n",sd.w);
	}
	@Test
	public void testn() throws IOException {		//测试-n
		String[] str = {"-n","2","-i","D:/text.txt"};
		ScDeal sd=new ScDeal(str);
		sd.judge();
		assertEquals("<learn>:4\r\n" + 
				"<study>:4\r\n",sd.w);
	}
}
